package com.kzw.oa.model.system;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.annotation.XmlTransient;

import org.springframework.security.core.GrantedAuthority;

import com.google.gson.annotations.Expose;

@SuppressWarnings("serial")
public class AppRole implements GrantedAuthority, Serializable {

	public static String ROLE_PUBLIC = "ROLE_PUBLIC";

	public static String ROLE_ANONYMOUS = "ROLE_ANONYMOUS";

	/**
	 * 超级管理员的角色ID
	 */
	public static final Long SUPER_ROLEID = 1L;
	/**
	 * 超级权限
	 */
	public static final String SUPER_RIGHTS = "__ALL";
	@Expose
	private Long roleId;
	@Expose
	private String roleName;
	@Expose
	private String roleDesc;
	@Expose
	private Short status;
	@Expose
	private Short isDefaultIn;

	@Expose
	private String rights;

	private Set<AppFunction> functions = new HashSet<AppFunction>();
	@XmlTransient
	private Set<AppUser> appUsers = new HashSet<AppUser>();

	public AppRole() {

	}

	public Short getIsDefaultIn() {
		return isDefaultIn;
	}

	public void setIsDefaultIn(Short isDefaultIn) {
		this.isDefaultIn = isDefaultIn;
	}

	public Set<AppUser> getAppUsers() {
		return appUsers;
	}

	public void setAppUsers(Set<AppUser> appUsers) {
		this.appUsers = appUsers;
	}

	public String getRights() {
		return rights;
	}

	public void setRights(String rights) {
		this.rights = rights;
	}

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	public Short getStatus() {
		return status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	public String getAuthority() {
		return roleName;
	}

	public int compareTo(Object o) {
		return 0;
	}

	public String getId() {
		return roleId.toString();
	}

	public String getName() {
		return roleName;
	}

	public Set<AppFunction> getFunctions() {
		return functions;
	}

	public void setFunctions(Set<AppFunction> functions) {
		this.functions = functions;
	}

}
